Various classes of graphical models describe computations that can be performed on computational hardware, such as a computer, microcontroller, field programmable gate array (FPGA), and custom hardware. Classes of such graphical models include time-based block diagrams such as those found within Simulink® from The MathWorks, Inc. of Natick, Mass., state-based and flow diagrams, such as those found within Stateflow® from The MathWorks, Inc. of Natick, Mass., entity-flow diagrams such as those found within SimEvents from The MathWorks, Inc. of Natick, Mass., data-flow diagrams, circuit diagrams, and software diagrams, such as those found in the Unified Modeling Language (UML), for example. UML is available from object management group (OMG). A common characteristic among these various forms of graphical models is that they define semantics on how to execute the graphical syntax of the model.
Historically, engineers and scientists have utilized graphical models in numerous scientific areas such as Feedback Control Theory and Signal Processing to study, design, debug, and refine dynamic systems. Dynamic systems, which are characterized by the fact that their behaviors change over time, or the fact that their states change or the fact that their behaviors change due to a system environment, are representative of many real-world systems. Graphical modeling has become particularly attractive over the last few years with the advent of software packages such as Simulink® from The MathWorks, Inc. of Natick, Mass. Such packages provide sophisticated software platforms with a rich suite of support tools that makes the analysis and design of dynamic systems efficient, methodical, and cost-effective.
A dynamic system, either natural or man-made, is a system whose response at any given time is a function of its inputs, its current state, the current time, and other input parameters. Such systems range from simple to highly complex systems. Physical dynamic systems include a falling body, the rotation of the earth, bio-mechanical systems (muscles, joints, etc.), bio-chemical systems (gene expression, protein pathways), weather and climate pattern systems, etc. Examples of man-made or engineered dynamic systems include: a bouncing ball, a spring with a mass tied on an end, automobiles, airplanes, control systems in major appliances, communication networks, audio signal processing, nuclear reactors, a stock market, etc.
Professionals from diverse areas such as engineering, science, education, and economics build graphical models of dynamic systems in order to better understand system behavior as it changes with the progression of time. The graphical models aid in building “better” systems, where “better” may be defined in terms of a variety of performance measures such as quality, time-to-market, cost, speed, size, power consumption, quality of service (QoS), robustness, etc. The graphical models also aid in analyzing, debugging and repairing existing systems (be it the human body or the anti-lock braking system in a car). The models may also serve the purpose of educating others on the basic principles governing physical systems. The models and results are often used as a scientific communication medium between humans. The term “model-based design” is used to refer to the use of graphical models in the development, analysis, and validation of dynamic systems, such as, for example, control systems and signal processing systems.
Graphical modeling environments such as Simulink® and various modeling applications associated with Simulink®, such as SimMechanics, SimPowerSystems, SimHydraulics, and SimDriveline, assist in simplifying the process of designing, simulating, and implementing dynamic systems. A graphical model can be a representation of a real-world system. The graphical representation of a dynamic system often consists of a graph containing nodes (i.e. blocks) interconnected by edges (i.e. lines). The blocks may be functional entities that perform mathematical operations, transformations, or both or enforce constraints on the data and information being processed by the system.
The simulation of a physical system involves solving a set of differential and algebraic equations (DAEs) where a set of algebraic constraints may specify the relationship of different body elements in the physical system, the relationship of different capacitor and inductor elements in the physical system, the relationship of different fluid capacity and inertia elements in the physical system, etc. Typically, the system evolves for a certain length of simulation time, optionally synchronized with real-time to facilitate, for example, hardware-in-the-loop simulation, under a fixed set of constraints. During this evolution, however, events may occur that change the set of active constraints of the system. After the set of constraints changes, the simulation continues under the new fixed set of constraints. Hence, the simulation solver needs to transition from using the old constraints to using the new constraints when the event occurs and signals a change in the relationship of the different elements in the physical system.
Simulation solvers can be generally separated into two categories: variable-step solvers and fixed-step solvers. Variable-step solvers can change the time step used throughout the simulation and hence can often detect precisely the exact time at which the set of the constraints of the physical system changes. However, it is difficult to estimate how long (in real time) the simulation will take using the variable-step solvers. In contrast, fixed-step solvers use simulation time steps of fixed duration to solve the simulation and, hence, the amount of real time that it will take to simulate the physical system can be predicted. However, because fixed-step solvers may not change the time step used within the simulation, it is very likely that the fixed-step solvers only detect the event signaling a change in constraints after the simulation has overshot the transition time. Once the fixed-step solvers detect the event, a different set of differential and algebraic equations and/or algebraic constraints are used to simulate the physical system. However, because of the overshot of the transition time, the subsequent simulation results of the physical system can be erroneous or inaccurate. One can usually mitigate this problem by decreasing the fixed simulation time step used by the fixed-step solvers; however, this is disadvantageous because the total simulation (real) time increases, sometimes dramatically, and oftentimes becomes unreasonable and impractical. Alternatively, more sophisticated algorithms and/or algorithms with fewer approximations can be used to accurately simulate the physical system by the fixed-step solvers. One approach is to employ a zero-crossing location algorithm to establish precisely when an indicator function generates the event, which often applies an iterative search to find the time where the resultant of the indicator function changes to zero, changes from zero, or crosses zero. However such an approach will also lengthen the overall simulation time. Hence there is a need to improve the use of fixed-step solvers such that both accuracy and efficiency can be preserved.